#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2025/11/2 17:21
# @Author  : summer
# @Email   : 610658552@qq.com
# @File    : ser_wechat_log.py
# @Software: PyCharm
# @Desc    : 微信公众号发送记录序列化器
from rest_framework import serializers

from wechat.models import WechatLog


class WechatLogSerializer(serializers.ModelSerializer):
    """微信公众号发送记录序列化器：格式化时间字段"""
    # 发送时间格式化（可读性更强）
    send_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", read_only=True)
    create_time = serializers.DateTimeField(format="%Y-%m-%d %H:%M:%S", read_only=True)

    class Meta:
        model = WechatLog
        fields = '__all__'  # 包含所有字段（可根据需求指定具体字段）